{template header}

<!--{if !empty($message)}-->
<script type="text/javascript" onload="1">
InFloat = 'floatlayout_register';
pagescroll.right();
{eval $bbname = str_replace('\'', '\\\'', $bbname);}
{if $regverify == 1}
	$('messageleft1').innerHTML = '<h1>{lang register_succeed} $bbname</h1>{lang profile_email_verify}';
	$('messageright1').innerHTML = '<h1><a href="memcp.php">{lang user_center}</a></h1><p>{lang profile_email_verify_comment}</p>';
	setTimeout("window.location.href='memcp.php'", $mrefreshtime);
{elseif $regverify == 2}
	$('messageleft1').innerHTML = '<h1>{lang register_succeed} $bbname</h1>{lang register_manual_verify}';
	$('messageright1').innerHTML = '<h1><a href="memcp.php">{lang user_center}</a></h1>';
	setTimeout("window.location.href='memcp.php'", $mrefreshtime);
{else}
	{if $newbietask}
		$('messageleft1').innerHTML = '<h1>{lang register_succeed} $bbname</h1>{lang register_newbietask}';
		$('messageright1').innerHTML = '<h1><a href="javascript:;" onclick="location.href=\'task.php?action=view&id=$task[taskid]\'">{lang login_refresh}</a></h1>';
		setTimeout('window.location.href=\'task.php?action=view&id=$task[taskid]\'', $mrefreshtime);
	{else}
		$('messageleft1').innerHTML = '<h1>{lang register_succeed} $bbname</h1>';
		$('messageright1').innerHTML = '<h1><a href="{echo dreferer()}">{lang login_refresh}</a></h1>';
		setTimeout('window.location.href=\'{echo dreferer()}\'', $mrefreshtime);
	{/if}
{/if}
{if $_DCACHE['settings']['frameon'] && $_DCOOKIE['frameon'] == 'yes'}
	if(top != self) {
		parent.leftmenu.location.reload();
	}
{/if}
floatwinreset = 1;
</script>
<!--{else}-->
<!--{if empty($infloat)}-->
	{subtemplate header_nofloat}
<!--{/if}-->
<div class="float" id="floatlayout_register" style="width: 600px;{if !empty($infloat)} height: 400px;{/if}">
	<div style="width: 1800px">
		<div class="floatbox floatbox1">
			<h3 class="float_ctrl">
				<span>
					<!--{if !empty($infloat)}--><a href="javascript:;" class="float_close" onclick="floatwin('close_register')" title="{lang close}">{lang close}</a><!--{/if}-->
				</span>
			</h3>
			<div id="bbrule" class="gateform">
				<h3>$bbname {lang rulemessage}</h3>
				<div class="clause">$bbrulestxt</div>
				<button onclick="$('agreebbrule').checked = true;$('bbrule').style.display='none';pagescroll.right()">{lang agree}</button> &nbsp; <button onclick="floatwin('close_register')">{lang disagree}</button>
			</div>
		</div>
		<div class="floatbox floatbox1">
			<h3 class="float_ctrl">
				<span>
					<!--{if !empty($infloat)}--><a href="javascript:;" class="float_close" onclick="floatwin('close_register')" title="{lang close}">{lang close}</a><!--{/if}-->
				</span>
			</h3>
			<form method="post" name="register" id="registerform" class="gateform" onsubmit="ajaxpost('registerform', 'returnmessage4', 'returnmessage4', 'onerror');return false;" action="$regname?regsubmit=yes">
				<h3 id="returnmessage4"><!--{if $action != 'activation'}-->$reglinkname<!--{else}-->{lang index_activation}<!--{/if}--></h3>
				<input type="hidden" name="formhash" value="{FORMHASH}" />
				<input type="hidden" name="referer" value="$referer" />
				<!--{if !empty($infloat)}--><input type="hidden" name="handlekey" value="$handlekey" /><!--{/if}-->
				<input type="hidden" name="activationauth" value="{if $action == 'activation'}$activationauth{/if}" />
				<div class="loginform regform">
					<div id="reginfo_a" class="regform" style="overflow:hidden">
						<span id="activation_hidden"{if $action == 'activation'} style="display:none"{/if}>
						<!--{if !empty($fromuser)}-->
							<span>
								<label><em>{lang register_from}:</em>$fromuser</label>
								<input type="hidden" name="fromuser"value="$fromuser" />
							</span>
						<!--{/if}-->
						<label><em>{lang username}:</em><input type="text" id="username" name="username" autocomplete="off" size="25" maxlength="15" value="" onBlur="checkusername()" tabindex="1" class="txt" /> *</label>
						<label><em>{lang password}:</em><input type="password" name="password" size="25" id="password" onkeypress="detectcapslock(event, this)" tabindex="1" class="txt" /> *</label>
						<label><em>{lang password_confirm}:</em><input type="password" name="password2" size="25" id="password2" onkeypress="detectcapslock(event, this)" tabindex="1" value="" class="txt" /> *</label>
						<label><em>{lang email}:</em><input type="text" name="email" autocomplete="off" size="25" id="email" onBlur="checkemail()" tabindex="1" class="txt" /> *</label>
						<label><em>&nbsp;</em><a href="https://domains.live.com/members/signup.aspx?domain=$msn[domain]" target="_blank" style="float: left; overflow: hidden; width: 223px; white-space: nowrap;"><!--{if $msn['on']}-->{lang msn_email_reglink}<!--{else}-->{lang msn_email_reglink_default}<!--{/if}--></a></label>
						</span>
						<!--{if $action == 'activation'}-->
							<span id="activation_user">
								<label><em>{lang username}:</em>$username</label>
							</span>
						<!--{/if}-->
						<!--{if $secqaacheck || $seccodecheck}-->
							<!--{if !empty($infloat)}-->{eval $secchecktype = 1;}<!--{else}-->{eval $seccheckreg = 2;}<!--{/if}-->
							<div class="regsec"><label style="display:inline"><em>{lang memcp_profile_security_check}: </em>{subtemplate seccheck}</label></div>
						<!--{/if}-->
						<!--{if ($regstatus > 1 && $action != 'activation') || $regstatus == 2}-->
							<label><em>{lang invite_code}:</em><input type="text" name="invitecode" autocomplete="off" size="25" maxlength="16" value="$invitecode" id="invitecode" onBlur="checkinvitecode()" tabindex="1" class="txt" /><!--{if $regstatus == 2}--> *<!--{/if}--></label>
						<!--{/if}-->
					</div>
					<div id="reginfo_b"{if !empty($infloat)} style="display:none;"{/if}>
						<!--{if $regverify == 2}-->
							<label><em>{lang register_message}:</em><input name="regmessage" autocomplete="off" size="25" tabindex="1" class="txt" /> *</label>
						<!--{/if}-->
						<!--{loop $_DCACHE['fields_required'] $field}-->
							<label{if $field['description']} title="{echo htmlspecialchars($field[description])}"{/if}><em>$field[title]:</em>
							<!--{if $field['selective']}-->
								<select name="field_$field[fieldid]new" tabindex="1">
								<option value="">{lang please_select}</option>
								<!--{loop $field['choices'] $index $choice}-->
									<option value="$index"{if $index == $member['field_'.$field[fieldid]]} selected="selected"{/if}>$choice</option>
								<!--{/loop}-->
								</select>
							<!--{else}-->
								<input type="text" name="field_$field[fieldid]new" size="25" value="$member['field_'.$field[fieldid]]" tabindex="1" class="txt" />
							<!--{/if}--> *
							</label>
						<!--{/loop}-->
					</div>
				</div>
				<div class="logininfo singleinfo">
					<h4>{lang login_now}</h4>
					<!--{if $action == 'activation'}-->
						<p>{lang login_inactive}</p>
					<!--{/if}-->
				</div>
				<p class="fsubmit">
					<span id="reginfo_a_btn">
						<em>&nbsp;</em>
					<!--{if ($field || $regverify == 2) && !empty($infloat)}-->
						<button class="submit" tabindex="1" onclick="regstep('reginfo_a','reginfo_b'); return false;">{lang register_next}</button>
					</span>
					<span id="reginfo_b_btn" style="display:none">
						<em class="regpre"><a href="javascript:;" onclick="regstep('reginfo_b','reginfo_a');">{lang register_pre}</a></em>
					<!--{/if}-->
						<button class="submit" id="registerformsubmit" type="submit" name="regsubmit" value="true" tabindex="1">{lang submit}</button>
						<!--{if $bbrules}-->
							<input type="checkbox" class="checkbox" name="agreebbrule" value="$bbrulehash" id="agreebbrule" /> <label for="agreebbrule">{lang agree}<a href="javascript:;" onclick="pagescroll.left()">{lang rulemessage}</a></label>
						<!--{/if}-->
					</span>
				</p>
			</form>
			<!--{if $sitemessage[register]}-->
				<div class="moreconf sitemsg">
					<div class="custominfoarea">
						<a href="javascript:;" onclick="display('custominfo_register')" onblur="$('custominfo_register').style.display = 'none'"><img src="{IMGDIR}/info.gif" alt="{lang faq}" /></a>
						<div id="custominfo_register" class="sitenote">
							<div class="cornerlayger">{echo $sitemessage[register][array_rand($sitemessage[register])]}</div>
							<div class="minicorner"></div>
						</div>
					</div>
				</div>
			<!--{/if}-->
		</div>
		<div class="floatbox floatbox1">
			<h3 class="float_ctrl">
				<span>
					<!--{if !empty($infloat)}--><a href="javascript:;" class="float_close" onclick="floatwin('close_register')" title="{lang close}">{lang close}</a><!--{/if}-->
				</span>
			</h3>
			<div class="validateinfo">
				<div id="messageleft1"></div>
				<div id="messageright1"></div>
			</div>
		</div>
	</div>
</div>

<script type="text/javascript" reload="1">
var pagescroll = new pagescroll_class('floatlayout_register', 600, 400);
{if empty($infloat)}
	$('floatlayout_register').scrollLeft = 600;
{/if}
{if $action != 'activation'}
document.body.focus();
try {
	$('username').focus();
} catch(e) {}
{/if}

{if $sitemessage[register] && $sitemessage[time]}
setTimeout('display_opacity(\'custominfo_register\',100)', $sitemessage[time]);
{/if}

var profile_username_toolong = '{lang register_profile_username_toolong}';
var profile_username_tooshort = '{lang register_profile_profile_username_tooshort}';
var doublee = parseInt('$doublee');
var lastusername = lastpassword = lastemail = lastinvitecode = '';

function messagehandle_register(key, msg) {
	$('returnmessage4').className = key == 1 ? 'onerror' : '';
	$('returnmessage4').innerHTML = msg;
}

function checkusername() {
	var username = trim($('username').value);
	if(username == '' || username == lastusername) {
		return;
	} else {
		lastusername = username;
	}
	var unlen = username.replace(/[^\x00-\xff]/g, "**").length;
	if(unlen < 3 || unlen > 15) {
		messagehandle_register(1, unlen < 3 ? profile_username_tooshort : profile_username_toolong);
		return;
	}
        ajaxget('ajax.php?infloat=register&handlekey=register&action=checkusername&username=' + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(username) : username), 'returnmessage4');
}

function checkemail() {
	var email = trim($('email').value);
	if(email == '' || email == lastemail) {
		return;
	} else {
		lastemail = email;
	}
	ajaxget('ajax.php?infloat=register&handlekey=register&action=checkemail&email=' + email, 'returnmessage4');

}
function checkinvitecode() {
	var invitecode = trim($('invitecode').value);
	if(invitecode == lastinvitecode) {
		return;
	} else {
		lastinvitecode = invitecode;
	}
        ajaxget('ajax.php?infloat=register&handlekey=register&action=checkinvitecode&invitecode=' + invitecode, 'returnmessage4');
}
function trim(str) {
	return str.replace(/^\s*(.*?)[\s\n]*$/g, '$1');
}
{if ($field && !empty($infloat)) || $regverify == 2}
function regstep(obja,objb){
	$(obja).style.display = $(obja+'_btn').style.display = 'none';
	$(objb).style.display = $(objb+'_btn').style.display = '';
}
{/if}
{if $invitecode}
ajaxget('ajax.php?infloat=register&handlekey=register&action=checkinvitecode&invitecode=$invitecode', 'returnmessage4');
{/if}
</script>
<!--{/if}-->

{eval updatesession();}
<!--{if empty($infloat)}-->
	{subtemplate footer_nofloat}
<!--{/if}-->
{template footer}